﻿using University.Workshop.Presenters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace University.Workshop.Tests
{
    
    
    [TestClass()]
    public class PresenterReportPurchaseTest
    {


        private TestContext testContextInstance;


        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        [TestMethod()]
        public void EnableAndDisableControlsTestOfAll()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.EnableAndDisableControlsAll();
            bool expected = true;
            bool actual;
            actual = target.EnableAndDisableControls();
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(false, view.EnabledProductGroup);
            Assert.AreEqual(false, view.EnabledProviderGroup);
            Assert.AreEqual(false, view.EnabledDateFrom);
            Assert.AreEqual(false, view.EnabledDateTo);
        }

        [TestMethod()]
        public void EnableAndDisableControlsTestOfProduct()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.EnableAndDisableControlsProducts();
            bool expected = true;
            bool actual;
            actual = target.EnableAndDisableControls();
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(true, view.EnabledProductGroup);
            Assert.AreEqual(false, view.EnabledProviderGroup);
            Assert.AreEqual(true, view.EnabledDateFrom);
            Assert.AreEqual(true, view.EnabledDateTo);
        }

        [TestMethod()]
        public void EnableAndDisableControlsTestOfProvider()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.EnableAndDisableControlsProviders();
            bool expected = true;
            bool actual;
            actual = target.EnableAndDisableControls();
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(false, view.EnabledProductGroup);
            Assert.AreEqual(true, view.EnabledProviderGroup);
            Assert.AreEqual(true, view.EnabledDateFrom);
            Assert.AreEqual(true, view.EnabledDateTo);
        }

        [TestMethod()]
        public void EnableAndDisableControlsTestOfDates()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.EnableAndDisableControlsDates();
            bool expected = true;
            bool actual;
            actual = target.EnableAndDisableControls();
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(false, view.EnabledProductGroup);
            Assert.AreEqual(false, view.EnabledProviderGroup);
            Assert.AreEqual(true, view.EnabledDateFrom);
            Assert.AreEqual(true, view.EnabledDateTo);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfAllPurchases()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfAllPurchases();
            string expected = "Reporte generado exitosamente!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfAProductFromTo()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfAProductFromTo();
            string expected = "Reporte generado exitosamente!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfAProductFromToFail()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfAProductFromToFail();
            string expected = "No existen compras, con el producto seleccionado o en el rango de fechas!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfAProviderFromTo()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfAProviderFromTo();
            string expected = "Reporte generado exitosamente!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfAProviderFromToFail()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfAProviderFromToFail();
            string expected = "No existen compras, con el proveedor seleccionado o en el rango de fechas!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfDates()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfDates();
            string expected = "Reporte generado exitosamente!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void OnGenerateReportTestOfDatesFail()
        {
            PurchaseReportMock view = new PurchaseReportMock();
            PresenterReportPurchase target = new PresenterReportPurchase(view);
            view.GenerateReportOfDatesFail();
            string expected = "No existen compras en el rango de fechas seleccionado!";
            string actual;
            actual = target.OnGenerateReport();
            Assert.AreEqual(expected, actual);
        }
    }
}
